package org.finalministry.objects;

public enum ContactTypeEnum {

	TOBEVISITED(null), STUDY("study"), OTHERLANGUAGE("otherlanguage"), DONOTVISIT("donotvisit"), DISFELLOWSHIPPED("disfellowshipped");

	private String name;

	ContactTypeEnum(String name) {
		this.name = name;
	}

	public String getName() {
		return name;
	}

	public static ContactTypeEnum getByName(String name) {

		for (ContactTypeEnum contactType : ContactTypeEnum.values()) {
			if (name == null) {
				return TOBEVISITED;
			}

			if (contactType.getName() == null)
				continue;

			if (contactType.getName().equals(name)) {
				return contactType;
			}
		}

		return TOBEVISITED;
	}
}
